package cliqueproblem;

/**
 *
 * @author Alexey Krasnoperov
 */
public class Main {
	public static void main(String[] args) {
		if (args.length == 0)
			System.out.println("Please, specify input file.");
		else {
			// Johnstons modification of Bron-Kerbosh algorithm.
			DotImport importFromDot = new DotImport(args[0]);
			importFromDot.importGraph();

			if (importFromDot.isCorrect()) {
				JohnstonsAlgorithm Cliques = new JohnstonsAlgorithm(importFromDot.getGraph());

				System.out.println("Start clique finding...");
				long begtime = System.nanoTime();
				Cliques.findCliques();
				System.out.println("Exec time: " + (System.nanoTime() - begtime) / 1000000 + "ms.");

				Cliques.markClique();
				if (new DotExport(Cliques.getGraph(), "result.dot").export())
					System.out.println("Result was written to result.dot");
			}
		}
	}
}